home *** CD-ROM | disk | FTP | other *** search
- // bdrdem2.cpp
- // Demo some stack, queue, list, array, and sort
- // member functions.
- // Link with binder.obj
-
- #include <string.h>
- #include <iomanip.h>
- #include "binder.hpp"
-
-
- main()
- {
- Binder B;
-
- B.push("Now is the time");
- B.atIns(B.Nodes(),"for all programmers");
- B.insQ("to stop reinventing");
- B.setCurNode(B.Nodes()-1);
- B.ins("the linked list!");
-
- cout << "\n\nBinder contains the following "
- << "nodes: \n\n";
-
- for (B.setCurNode(); B++;
- cout << (char *)(voiD) B << endl);
-
- cout << "\n\nPress enter to continue ... ";
- cin.get();
-
-
-
-
- Binder B2;
-
- B2.setComparE((BDRcomparE)strcmp);
-
- while (B2.insSort(B++));
-
- B.sort((BDRcomparE)strcmp);
-
- cout << "\n\nAnd the Binder sorted:\n\n";
-
- while (B.setCurNode(0))
- cout << (char *) B.del() << endl;
-
- cout << "\n\nAnd an alternate Binder "
- "insertion sorted:\n\n";
-
- while (B2.Nodes())
- cout << (char *) B2.pop() << endl;
-
-
- cout << "\n\nPress enter to quit ... ";
- cin.get();
-
- return 0;
- }
-